package com.tangyee.person_risk_assessment.data;

import java.util.ArrayList;
import java.util.List;

import top.defaults.view.PickerView;

/**
 * 在评估时，身高问题对应的选项
 */
public class UserHeight implements PickerView.PickerItem {

    private String height;

    public UserHeight(String height){
        this.height = height;
    }

    @Override
    public String getText() {
        return height;
    }

    public float getHeight(){
        return Float.parseFloat(height);
    }

    public static List<UserHeight> getUserHeightList(){
        List<UserHeight> userHeightList = new ArrayList<>();

        /**
         * minHeight = 1.20
         * maxHeight = 2.20
         */
        for (int i = 1 ; i <= 2; i++ ){
            /**
             * 身高范围
             * 1.20 -- 1.99
             */
            if(i == 1) {
                for (int j = 2; j <= 9; j++) {
                    for (int k = 0; k <= 9; k++) {
                        String currentHeight = i + "." + j + k;
                        userHeightList.add(new UserHeight(currentHeight));
                    }
                }
            }else { // i==2
                /**身高的范围
                 * 2.00 --  2.19
                 */
                for (int j = 0; j < 2; j++) {
                    for (int k = 0; k <= 9; k++) {
                        String currentHeight = i + "." + j + k;
                        userHeightList.add(new UserHeight(currentHeight));
                    }
                }
                // 身高 2.20
                userHeightList.add(new UserHeight("2.20"));
            }
        }

        return userHeightList;
    }

    public static List<UserHeight> getUserHeightUnit(){
        List<UserHeight> unit = new ArrayList<>();
        unit.add(new UserHeight("m"));
        return unit;
    }

}
